#ifndef _XGBA_INTERRUPT_H_
#define _XGBA_INTERRUPT_H_
#include "xgba_p.h"

typedef PACKED struct{
    uint16_t disable_interrupts:1;
    uint16_t nused:15;
}xgba_ime_t;

typedef PACKED struct{
    uint16_t lcd_vblank:1;
    uint16_t lcd_hblank:1;
    uint16_t lcd_vcounter:1;
    uint16_t timer0_overflow:1;
    uint16_t timer1_overflow:1;
    uint16_t timer2_overflow:1;
    uint16_t timer3_overflow:1;
    uint16_t serial:1;
    uint16_t dma0:1;
    uint16_t dma1:1;
    uint16_t dma2:1;
    uint16_t dma3:1;
    uint16_t keypad:1;
    uint16_t game_pak:1;
    uint16_t nused:2;
}xgba_ie_t;

typedef PACKED struct{
    uint16_t lcd_vblank:1;
    uint16_t lcd_hblank:1;
    uint16_t lcd_vcounter:1;
    uint16_t timer0_overflow:1;
    uint16_t timer1_overflow:1;
    uint16_t timer2_overflow:1;
    uint16_t timer3_overflow:1;
    uint16_t serial:1;
    uint16_t dma0:1;
    uint16_t dma1:1;
    uint16_t dma2:1;
    uint16_t dma3:1;
    uint16_t keypad:1;
    uint16_t game_pak:1;
    uint16_t nused:2;
}xgba_if_t;

#define IME ((xgba_ime_t*)gba->io[0x208])->disable_interrupts
#define IE  ((xgba_ie_t *)gba->io[0x200])
#define IF  ((xgba_if_t *)gba->io[0x202])

#endif
